﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data;

namespace Fjaspx.UI.Web.Article
{
    public partial class Article : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        public Fjaspx.Sys.Model.Fjaspx_Article ArticleInfo()
        {
            if (Request.QueryString["Id"] != null)
            {
                if (new Fjaspx.Sys.Bll.Fjaspx_Article().Exists(Convert.ToInt32(Request.QueryString["Id"])))
                    return new Fjaspx.Sys.Bll.Fjaspx_Article().GetModel(Convert.ToInt32(Request.QueryString["Id"].ToString()));
            } return new Fjaspx.Sys.Model.Fjaspx_Article();
        }

        public string CorrelateArticle()
        {
            StringBuilder sb = new StringBuilder();
            DataSet ds = new Fjaspx.Sys.Bll.Fjaspx_Article().GetList("Recommend=0 order by artDate desc", 8);
            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
                {
                    sb.Append("<a class='LinkArticleCorrelative' title='文章标题：" + ds.Tables[0].Rows[i]["ArtTitle"].ToString() + "&#13;&#10;作&nbsp;&nbsp;&nbsp;&nbsp;者：" + ds.Tables[0].Rows[i]["ArtAuthor"].ToString() + "&#13;&#10;更新时间：" + Convert.ToDateTime(ds.Tables[0].Rows[i]["ArtDate"]).ToString("yyyy-MM-dd") + "'     href='" + ds.Tables[0].Rows[i]["OrderId"].ToString() + ".html' target='_self'>" + ds.Tables[0].Rows[i]["ArtTitle"].ToString() + "</a><br>");
                }
            }
            return sb.ToString();
        }
    }
}